package wql.aaa.controller;

import com.aaa.entity.TbHeadNav;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import wql.aaa.service.HeadNovService;
import wql.aaa.vo.FormData;

/**
 * @author wql
 * @version 1.0
 * @date 2023/2/27 11:08
 */
@RestController
@RequestMapping("/home/headNav")

public class HeadNovController {

    @Autowired
    private HeadNovService headNovService;

    /**
     * 查询
     * @param currentPage
     * @param pageSize
     * @param formData
     * @return
     */
    @PostMapping("/fuzzySearch")
    public Result list( Integer currentPage, Integer pageSize, @RequestBody FormData formData){
        return headNovService.findAll( currentPage,pageSize,formData);
    }

    /**
     * 添加
     * @param tbHeadNav
     * @return
     */
    @PostMapping("/insertNavigation")
    public Result add(@RequestBody TbHeadNav tbHeadNav){
        return  headNovService.add(tbHeadNav);
    }

    /**
     * 修改
     * @param tbHeadNav
     * @return
     */
    @PostMapping("/updateNavigation")
    public Result update(@RequestBody TbHeadNav tbHeadNav){
        return headNovService.update(tbHeadNav);
    }

    /**
     * 修改状态
     * @param headId
     * @param isDisable
     * @return
     */
    @PostMapping("/updateDisable/{headId}/{isDisable}")
    public Result updateDisable(@PathVariable Integer headId,@PathVariable String isDisable){
        return headNovService.updateIsDisabled(headId,isDisable);
    }

    /**
     * 删除
     * @param headId
     * @return
     */
    @GetMapping("/removeNavigation")
    public Result delete( Integer headId){
        return headNovService.dalete(headId);
    }

    @GetMapping("/navigationSearch")
    public Result selectType(){
        return  headNovService.selectType();
    }
}
